package com.dfbz.springboot_project.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import java.util.Date;
import java.util.Objects;

@Entity
public class Service {
    private Integer serviceId;
    private String osUsername;
    private String loginPasswd;
    private String serviceStatus;
    private Date serviceCreateDate;
    private Date servicePauseDate;
    private Date serviceCloseDate;

    @Id
    @Column(name = "service_id", nullable = false)
    public Integer getServiceId() {
        return serviceId;
    }

    public void setServiceId(Integer serviceId) {
        this.serviceId = serviceId;
    }

    @Basic
    @Column(name = "os_username", nullable = false, length = 8)
    public String getOsUsername() {
        return osUsername;
    }

    public void setOsUsername(String osUsername) {
        this.osUsername = osUsername;
    }

    @Basic
    @Column(name = "login_passwd", nullable = false, length = 8)
    public String getLoginPasswd() {
        return loginPasswd;
    }

    public void setLoginPasswd(String loginPasswd) {
        this.loginPasswd = loginPasswd;
    }

    @Basic
    @Column(name = "service_status", nullable = true, length = 1)
    public String getServiceStatus() {
        return serviceStatus;
    }

    public void setServiceStatus(String serviceStatus) {
        this.serviceStatus = serviceStatus;
    }

    @Basic
    @Column(name = "service_create_Date", nullable = true)
    public Date getServiceCreateDate() {
        return serviceCreateDate;
    }

    public void setServiceCreateDate(Date serviceCreateDate) {
        this.serviceCreateDate = serviceCreateDate;
    }

    @Basic
    @Column(name = "service_pause_Date", nullable = true)
    public Date getServicePauseDate() {
        return servicePauseDate;
    }

    public void setServicePauseDate(Date servicePauseDate) {
        this.servicePauseDate = servicePauseDate;
    }

    @Basic
    @Column(name = "service_close_Date", nullable = true)
    public Date getServiceCloseDate() {
        return serviceCloseDate;
    }

    public void setServiceCloseDate(Date serviceCloseDate) {
        this.serviceCloseDate = serviceCloseDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Service service = (Service) o;
        return serviceId == service.serviceId &&
                Objects.equals(osUsername, service.osUsername) &&
                Objects.equals(loginPasswd, service.loginPasswd) &&
                Objects.equals(serviceStatus, service.serviceStatus) &&
                Objects.equals(serviceCreateDate, service.serviceCreateDate) &&
                Objects.equals(servicePauseDate, service.servicePauseDate) &&
                Objects.equals(serviceCloseDate, service.serviceCloseDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serviceId, osUsername, loginPasswd, serviceStatus, serviceCreateDate, servicePauseDate, serviceCloseDate);
    }
}
